{include file='fcworker/fc_head'}
<style type="text/css">
    .btn-div{
        width: 100%;
        text-align: center;
        margin: 0 auto;
    }
    .btn{
        width: 184px;
        height: 35px;
        background-color: #5c99f7;
        border-radius: 50px;
        border: 0;
        margin-top: 20px;
        color: #fff;
        font-size: 15px;
        font-weight: 400;
    }
</style>
<body style="background:#f8f8f8">
<div id="mescroll" class="mescroll">
    <div id="app">
        <div class="setTitle_h">
            <a href="javascript:history.back(-1)"></a>
            在线充值
        </div>
        <form id="myform3">
            <div class="setActive">
                <div class="actTit">
                    当前可用余额：<span style="color: red;font-size: 30px">{$recharge['fee']}元</span>
                </div>
                <ul>
                    <li>
                        <p>充值金额</p>
                        <input type="text" name="fee" id="fee" placeholder="请输入充值金额" confirm-type="next" value="">
                    </li>
                </ul>
            </div>
            <div class="btn-div martop80">
                <button class="btn" id="sub3" type="button">充值</button>
            </div>
        </form>
        <script>
            $("#sub3").click(function () {
                var fee = $('#fee').val();
                var forward = '{php echo $fans['nickname']=='微信用户' || $fans['nickname']=='新用户'?\app\model\Fans::get_login_url($system,$theme):'';}';
                if (forward){
                    window.location.href=forward;
                    return ;
                }
                if (fee.length==0 || fee < 0) {
                    alert('请输入充值金额');
                    return false;
                }
                $.ajax({
                    type: 'POST',
                    dataType: "json",
                    data: {fee: fee},
                    url:'/{php echo createMobileUrl("w_recharge",array("themeid"=>$themeid,"op"=>"pay"));}',
                    success: function (data) {
                        var json = data.message;
                        console.log(json);
                        if (json.errcode == 0) {
                            if (json.payway == 0) {
                                window.location.href = json.url;
                            } else {
                                //tips(json.tid);
                                util.pay({
                                    orderFee: json.fee,
                                    payMethod: 'wechat',
                                    orderTitle: json.title,
                                    orderTid: json.tid,
                                    module: '{$_P['m']}',
                                    success: function (result) {
                                        tips2('支付成功', '{$config["payedurl"]}');
                                    },
                                    fail: function (result) {
                                        alert('fail : ' + result.message);
                                    },
                                    complete: function (result) {
                                        location.reload();
                                    }
                                });
                            }
                        }
                    }
                });
            })
        </script>
        {include file='fcworker/fc_foot_yixuan'}
        <div class="h110"></div>
        <div style="padding: 30px;color: #666666">{$recharge['tips']}</div>
    </div>
</div>
{include file='fcworker/fc_foot'}
<script>
    const mescroll = new MeScroll("mescroll", {
        down: {
            auto: false,
            callback: () => {
                mescroll.endSuccess();
                setTimeout(() => {
                    window.location.reload();
                },500)
            }
        },
        up: {
            use: false
        }
    })
</script>
</body>
</html>